#include "stdafx.h"
#include "ThreadManager.h"

namespace Network {
	ThreadManager* ThreadManager::instance_ = NULL;

	ThreadManager* ThreadManager::instance(void)
	{
		if(instance_ == NULL){
			instance_ = new ThreadManager();
		}
	
		return instance_;
	}

	ThreadManager::ThreadManager(void){
	}

	ThreadManager::~ThreadManager(void)
	{
		if(instance_ == NULL){
			delete(instance_);
		}
	}

	void ThreadManager::spawn(void* (*function_entry_point) (void *), void *arg, long flags, long stack_size, void *stack_pointer, DWORD *t_id)
	{
		CreateThread( NULL, stack_size, (LPTHREAD_START_ROUTINE)function_entry_point, arg, flags, t_id ); 
	}
}